package com.kongjs.online.preview.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OnlinePreviewConfiguration {
    @Value("${online.preview.file.uri}")
    private String onlinePreviewFileUri;
    @Value("${online.preview.file.dir}")
    private String onlinePreviewFileDir;
    @Value("${msoffice-home}")
    private String msOfficeHome;

    public String getOnlinePreviewFileUri() {
        if (!onlinePreviewFileUri.startsWith("/")){
            onlinePreviewFileUri="/"+onlinePreviewFileUri;
        }
        if (onlinePreviewFileUri.lastIndexOf("/")!=onlinePreviewFileUri.length()-1){
            onlinePreviewFileUri=onlinePreviewFileUri+"/";
        }
        return onlinePreviewFileUri;
    }

    public String getOnlinePreviewFileDir() {
        if (onlinePreviewFileDir.lastIndexOf("/")!=onlinePreviewFileDir.length()-1){
            onlinePreviewFileDir=onlinePreviewFileDir+"/";
        }
        return onlinePreviewFileDir;
    }

    public String getMsOfficeHome() {
        return msOfficeHome;
    }
}